package com.mine.frame.mylandemo.adapter.forick

import com.chad.library.adapter.base.BaseSectionQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mine.frame.mylandemo.R
import com.mine.frame.mylandemo.entity.forick.ControlBean
import com.third.device.mg.serialport.utils.toHexString

/**
 * company 广东玛格家居有限公司
 * @author smoker
 * @Date 2021/12/27
 * Description:弗雷克 三合一 环境面板控制列表
 */
class Panel3In1Adapter : BaseSectionQuickAdapter<ControlBean, BaseViewHolder>(
    R.layout.item_control_title,
    R.layout.item_control_content
) {
    override fun convert(holder: BaseViewHolder, item: ControlBean) {
        holder.setText(R.id.tvName ,item.controlName)
        item.command?.let {
            holder.setText(R.id.tvCMD ,it.toHexString())
        }
        item.readHLR?.let {
            holder.setVisible(R.id.btnGet ,true)

        }?:let {
            holder.setVisible(R.id.btnGet ,false)
        }
        holder.setVisible(R.id.ivIndicator ,item.isVerify)
    }

    override fun convertHeader(helper: BaseViewHolder, item: ControlBean) {
        helper.setText(R.id.tvTitle ,item.controlName)
    }
}